package org.grapes.wine.api.client.rest;

import org.grapes.wine.api.client.method.proxy.ProxyWineMethod;
import org.grapes.wine.api.client.param.RestClientConfig;

public class GrapeRestClient extends ProxyWineMethod {

	protected final String apiKey;
	protected String sessionKey;
	protected final String serverUrl;
	
	protected int userId;
	protected int timeout;

	public GrapeRestClient(String apiKey) {
		this(apiKey, null, RestClientConfig.SERVER_ADDR);
	}

	public GrapeRestClient(String apiKey, String sessionKey) {
		this(apiKey, sessionKey, RestClientConfig.SERVER_ADDR);
	}
	
	public GrapeRestClient(String apiKey, String sessionKey, String serverUrl) {
		super(apiKey, sessionKey, serverUrl);
		this.sessionKey = sessionKey;
		this.apiKey = apiKey;
		this.serverUrl = (null != serverUrl) ? serverUrl
				: RestClientConfig.SERVER_ADDR;
		this.userId = -1;
	}

	public String getSessionKey() {
		return sessionKey;
	}

	public void setSessionKey(String key) {
		sessionKey = key;
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int id) {
		userId = id;
	}

	public String getResponseFormat() {
		// default format value is "xml"
		return "xml";
	}
}
